<?php 
//引进配置信息
include '../include/init.php';
//引入数据库配置信息
include '../include/mysql.config.php';
//引入公共函数
include '../include/common.fun.php';
islogin();

if ($_POST){
	$title=$_POST['title'];
	$url=$_POST['content'];

	if ($title&&$url) {
		$sql="SELECT count(*) as count from wd_link";
		$catId=$db->getOne($sql);
		$linkCatId=$catId['count']+1;
		$date=array(
			'link_name' => $title,
			'link_addtime' => time(),
			'link_url' => $url,
			'link_cat_id'=>$linkCatId
		);
		insert('wd_link',$date);
		alert('添加成功','link_list.php');exit;
	}else{
		alert('添加失败');exit;
	}
}


include 'view/link_add.php';